<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/WEB-INF/faces/template.xhtml">
        <ui:define name="title">
            <h:outputText value="New Customer"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <p:growl sticky="true"/>              
            </h:panelGroup>
            <p:panel header="Add Customer" style="border: none;">
                <h:form>
                    <h:panelGrid id="entryPanel" columns="3">
                        <h:outputLabel value="Company Name" for="companyName" />
                        <h:inputText id="companyName" value="#{customerBean.selected.companyName}" />
                        <p:message for="companyName" />
                        <h:outputLabel value="Contact Name" for="contactName" />
                        <h:inputText id="contactName" value="#{customerBean.selected.contactName}" requiredMessage="* Required" required="true"/>
                        <p:message for="contactName" />
                        <h:outputLabel value="Pan Number" for="panNumber" />
                        <h:inputText id="panNumber" value="#{customerBean.selected.panNumber}" />
                        <p:message for="panNumber" />
                        <h:outputLabel value="Address" for="address" />
                        <h:inputText id="address" value="#{customerBean.selected.address}" requiredMessage="* Required" required="true"/>
                        <p:message for="address" />
                        <h:outputLabel value="Contact Number" for="contactNumber" />
                        <h:inputText id="contactNumber" value="#{customerBean.selected.contactNumber}" requiredMessage="* Required" required="true"/>
                        <p:message for="contactNumber" />
                        <h:outputLabel value="Email" for="email" />
                        <h:inputText id="email" value="#{customerBean.selected.email}"/>
                        <p:message for="email" />

                    </h:panelGrid>

                    <br/>
                    <p:commandButton action="#{customerBean.create}" value="Save" update="entryPanel"/>

                    <p:commandButton action="pretty:listCustomers" value="Cancel" immediate="true"/>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>
